#pragma once
#include <typeinfo>

//template <class T>
class Ba_Holder
{
public:
	Ba_Holder(){}
	virtual ~Ba_Holder(){}
	virtual Ba_Holder* clone() = 0;
	virtual const std::type_info& type() const = 0;
};

template <class T>
class Holder:public Ba_Holder
{
private:
	T held_;
public:
	Holder(T data) :held_(data) {}
	template <class U>
	Holder(const Holder<U> &lhs) {
		this->held_ = static_cast<U>(lhs->getvalue());
	}
	~Holder(){}
	Holder<T>* clone()
	{
		return new Holder<T>(held_);
	}
	
	const std::type_info& type() const noexcept override
	{
		return typeid(held_);
	}
	
	T& getvalue()
	{
		return held_;
	}
};



